package com.wxxymakers.cklabrecruit.mapper;

import com.wxxymakers.cklabrecruit.entity.SysInfo;
import com.wxxymakers.cklabrecruit.entity.SysInfoExample;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface SysInfoMapper {
    long countByExample(SysInfoExample example);

    int deleteByExample(SysInfoExample example);

    @Delete({
        "delete from sys_info",
        "where Id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into sys_info (video_view, views, ",
        "use_email_id, can_reg, ",
        "datetime)",
        "values (#{videoView,jdbcType=VARCHAR}, #{views,jdbcType=VARCHAR}, ",
        "#{useEmailId,jdbcType=INTEGER}, #{canReg,jdbcType=BIT}, ",
        "#{datetime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(SysInfo record);

    int insertSelective(SysInfo record);

    List<SysInfo> selectByExample(SysInfoExample example);

    @Select({
        "select",
        "Id, video_view, views, use_email_id, can_reg, datetime",
        "from sys_info",
        "where Id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("com.wxxymakers.cklabrecruit.mapper.SysInfoMapper.BaseResultMap")
    SysInfo selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") SysInfo record, @Param("example") SysInfoExample example);

    int updateByExample(@Param("record") SysInfo record, @Param("example") SysInfoExample example);

    int updateByPrimaryKeySelective(SysInfo record);

    @Update({
        "update sys_info",
        "set video_view = #{videoView,jdbcType=VARCHAR},",
          "views = #{views,jdbcType=VARCHAR},",
          "use_email_id = #{useEmailId,jdbcType=INTEGER},",
          "can_reg = #{canReg,jdbcType=BIT},",
          "datetime = #{datetime,jdbcType=TIMESTAMP}",
        "where Id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(SysInfo record);
}